import Vue from 'vue'
import VueRouter from 'vue-router'
import BigDad from '../BigDad.vue'
import register from '../view/user/register/register.vue'
import login from '../view/user/login/login.vue'
import persion from '../view/user/persion/persion.vue'
import NotFound from '../NotFound.vue'
import pro_main from '../view/product/main/pro_main.vue'
import pro_cart from '../view/product/cart/pro_cart.vue'
import order_list from '../view/order/order_list/order_list.vue'
import changepsw from '../view/user/persion/changepsw/changepsw.vue'
import forgetpsw from '../view/user/persion/changepsw/forgetpsw.vue'
import checkpsw from '../view/user/persion/changepsw/checkpsw.vue'
import sendCode from '../view/user/persion/changepsw/sendCode.vue'
import phoneBand from '../view/user/register/phoneBand.vue'
import infoshow from '../view/user/persion/changeinfo/infoshow.vue'
import checkphone from '../view/user/persion/changeinfo/checkphone.vue'
import newphone from '../view/user/persion/changeinfo/newphone.vue'
import checkCode from '../view/user/persion/changeinfo/checkCode.vue'
import chooseSex from '../view/user/persion/changeinfo/chooseSex.vue'
import checkemail from '../view/user/persion/changeinfo/checkemail.vue'
import newemail from '../view/user/persion/changeinfo/newemail.vue'
import addressShow from '../view/user/persion/changeaddress/addressShow.vue'
import editAddress from '../view/user/persion/changeaddress/editAddress.vue'
import intercept_backspace from '../view/common/intercept_backspace.vue'

import jiangjiang from '../view/common/jiangjiang.vue'
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
        return originalPush.call(this, location).catch(err => err)
}

Vue.use(VueRouter)

const routes = [
  {
    path: '/jiangjiang',
    name: 'jiangjiang',
    component: jiangjiang
  },
  {
    path: '/editAddress',
    name: 'editAddress',
    component: editAddress
  },
  {
    path: '/addressShow',
    name: 'addressShow',
    component: addressShow
  },
  {
    path: '/newemail',
    name: 'newemail',
    component: newemail
  },
  {
    path: '/checkemail',
    name: 'checkemail',
    component: checkemail
  },
  {
    path: '/chooseSex',
    name: 'chooseSex',
    component: chooseSex
  },
  {
    path: '/checkCode',
    name: 'checkCode',
    component: checkCode
  },
  {
    path: '/newphone',
    name: 'newphone',
    component: newphone
  },
  {
    path: '/checkphone',
    name: 'checkphone',
    component: checkphone
  },
  {
    path: '/infoshow',
    name: 'infoshow',
    component: infoshow
  },
  {
    path: '/phoneBand',
    name: 'phoneBand',
    component: phoneBand
  },
  {
    path: '/sendCode',
    name: 'sendCode',
    component: sendCode
  },
  {
    path: '/changepsw',
    name: 'changepsw',
    component: changepsw
  },
  {
    path: '/forgetpsw',
    name: 'forgetpsw',
    component: forgetpsw
  },
  {
    path: '/checkpsw',
    name: 'checkpsw',
    component: checkpsw
  },
  {
    path:'*',
    component:NotFound
  },
  {
    path: '/BigDad',
    name: 'BigDad',
    component: BigDad
  },
  {
    path: '/persion',
    name: 'persion',
    component: persion,
    children:[
      {
        path: '/intercept_backspace',
        name: 'intercept_backspace',
        component: intercept_backspace
      },
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: login
  },
  {
    path: '/register',
    name: 'register',
    component: register
  },
  {
    path: '/pro_main',
    name: 'pro_main',
    component: pro_main,
  },
  {
    path: '/pro_cart',
    name: 'pro_cart',
    component: pro_cart,
  },
  {
    path: '/order_list',
    name: 'order_list',
    component: order_list,
  },
]

const router = new VueRouter({
  mode: 'history',
  routes
})

export default router
